home *** CD-ROM | disk | FTP | other *** search
/ Champak 45 / Vol 45.iso / games / bubblegu.swf / scripts / frame_2 / DoAction_12.as < prev    next >
Encoding:
Text File  |  2007-04-20  |  3.1 KB  |  119 lines

  1. gk1 = "BubbleGumRun";
  2. loadVariables(userInfoURL,this.getNextHighestDepth());
  3. gotKey = true;
  4. _global.loadScores = function(score, obj)
  5. {
  6.    trace("load obj: " + obj);
  7.    delete home.scoreList;
  8.    home.scoreList = new LoadVars();
  9.    trace("Initiating Load");
  10.    home.scoreList.onLoad = function(success)
  11.    {
  12.       if(success)
  13.       {
  14.          trace("Highscores loaded successfully.");
  15.          for(var _loc1_ in home.scoreList)
  16.          {
  17.             trace(_loc1_ + " -> " + home.scoreList[_loc1_]);
  18.          }
  19.          setScores(1,obj);
  20.       }
  21.       else
  22.       {
  23.          setScores(0,obj);
  24.          trace("An error occurred while loading highscores.");
  25.       }
  26.    };
  27.    if(score != undefined)
  28.    {
  29.       trace("You have submitted a score to the list");
  30.       home.scoreList.load(score);
  31.    }
  32.    else
  33.    {
  34.       var _loc2_ = home.highScoresURL + "?gk=" + home.gk1;
  35.       trace("You have requested the highscore list");
  36.       home.scoreList.load(_loc2_);
  37.    }
  38. };
  39. _global.getScores = function(score, obj)
  40. {
  41.    var _loc2_ = obj;
  42.    trace("get obj: " + _loc2_);
  43.    if(score != undefined || score != null)
  44.    {
  45.       var _loc1_ = score;
  46.       var _loc3_ = home.highScoresURL + "?gk=" + home.gk1 + "&uk=" + home.userKey + "&s=" + _loc1_ + "&es=" + encrypt(_loc1_) + "&sd=" + home.seed;
  47.       loadScores(_loc3_,_loc2_);
  48.    }
  49.    else
  50.    {
  51.       loadScores(null,_loc2_);
  52.    }
  53. };
  54. _global.setScores = function(type, obj)
  55. {
  56.    var _loc2_ = obj;
  57.    trace("set obj: " + _loc2_);
  58.    if(type)
  59.    {
  60.       if(home.scoreList.rank != undefined)
  61.       {
  62.          home.returnedInfo = "Good Job, you\'ve made the list. Your RANK is " + home.scoreList.rank;
  63.       }
  64.       else
  65.       {
  66.          home.returnedInfo = "You\'re score did not make the list";
  67.       }
  68.       var _loc1_ = 1;
  69.       while(_loc1_ <= 10)
  70.       {
  71.          _loc2_["total_" + _loc1_] = home.scoreList["hs_" + _loc1_ + "_score"] + " pts - " + home.scoreList["hs_" + _loc1_ + "_username"];
  72.          _loc1_ = _loc1_ + 1;
  73.       }
  74.    }
  75. };
  76. _global.encrypt = function(encScore)
  77. {
  78.    var _loc2_ = encScore;
  79.    _loc2_ = _loc2_.toString();
  80.    my_date = new Date();
  81.    my_date.hours = my_date.getUTCHours();
  82.    my_date.minutes = my_date.getUTCMinutes();
  83.    my_date.seconds = my_date.getUTCSeconds();
  84.    if(my_date.seconds < 10)
  85.    {
  86.       my_date.seconds = "0" + my_date.seconds;
  87.    }
  88.    if(my_date.minutes < 10)
  89.    {
  90.       my_date.minutes = "0" + my_date.minutes;
  91.    }
  92.    if(my_date.hours < 10)
  93.    {
  94.       my_date.hours = "0" + my_date.hours;
  95.    }
  96.    home.seed = my_date.hours + ":" + my_date.minutes + ":" + my_date.seconds + ":28";
  97.    charList = new Array(2,8,10,5,4,1,11,7);
  98.    keyChars = new Array();
  99.    i = 0;
  100.    while(i < 8)
  101.    {
  102.       var _loc1_ = charList[i];
  103.       keyChars.push(seed.charAt(_loc1_ - 1));
  104.       i++;
  105.    }
  106.    snafuText = "";
  107.    i = 0;
  108.    while(i < _loc2_.length)
  109.    {
  110.       tempHolder = keyChars.shift();
  111.       keyChars.push(tempHolder);
  112.       tempName = "ascii" + i;
  113.       tempName = _loc2_.charCodeAt(i) + Math.round(tempHolder);
  114.       snafuText = snafuText add String.fromCharCode(tempName);
  115.       i++;
  116.    }
  117.    return snafuText;
  118. };
  119.